#ifndef ARMY_DOM_UNIT_H
#define ARMY_DOM_UNIT_H

#include <QSharedDataPointer>
#include <QString>
//=========================
#include "army_dom_base.h"
#include "p_army_dom_unit_data.h"



class ArmyDomUnit
{
public:
    ArmyDomUnit();
    ArmyDomUnit(const QString& name, const QString& addr);
    ArmyDomUnit(const QString& name, const QString& addr, armydom::RankType rankType);
    ~ArmyDomUnit();
    ArmyDomUnit(const ArmyDomUnit& other);
    ArmyDomUnit& operator=(const ArmyDomUnit& other);

public:
    // SET:
    inline void setName(const QString& name)
    { m_data->m_name = name; m_data->m_rankType = chooseRankType(name); }
    inline void setAddr(const QString& addr)
    { m_data->m_addr = addr; }
    inline void setRank(armydom::RankType rankType)
    { m_data->m_rankType = rankType; }
    // GET:
    inline QString getName()
    { return m_data->m_name; }
    inline QString getAddr()
    { return m_data->m_addr; }
    inline armydom::RankType getRank()
    { return m_data->m_rankType; }

public:
    static armydom::RankType chooseRankType(const QString& name);

protected:
    QSharedDataPointer<PArmyDomUnitData> m_data;
};

#endif // ARMY_DOM_UNIT_H
